<template>
  <div class="box">
    <header class="header">
      <van-nav-bar title="标题" left-text="返回" left-arrow @click-left="$router.back()" />
    </header>
    <main class="content">
      <van-cell title="黎女士   18356942131" is-link label="江苏南京梧桐小镇" />
      <van-swipe-cell v-for="item in store.orderList">
        <van-card :num="item.count" :price="item.price" :title="item.title" class="goods-card" :thumb="item.image" />
      </van-swipe-cell>
    </main>
  </div>
  <footer>
    <van-submit-bar :price="store.totalPrice*100" button-text="立即支付" @submit="onSubmit" />

  </footer>
</template>

<script setup>
import { useCounterStore } from '@/stores/counter'
// 可以在组件中的任意位置访问 `store` 变量 ✨
const store = useCounterStore()
import request from '@/tool/request'
const onSubmit=()=>{
  let obj={
  id:new Date().getTime(),
  title:'NO'+new Date().getTime(),
  price:store.totalPrice
  }
  request.get('/pay',{
    params:obj
  }).then(res=>{
    if(res.data.code==200){
    window.location.href=res.data.data
    }
  })
}


</script>

<style lang="scss" scoped></style>